package net.easyjava.framework.web.listener;

import net.easyjava.framework.utils.ProjectProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * Created by wxnacy on 16/7/1.
 */
public class ProjectInitializedListener implements ServletContextListener {
    public static final Logger logger = LoggerFactory.getLogger(ProjectInitializedListener.class);

    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        boolean environment = Boolean.valueOf(ProjectProperties.getInstance().getProperty("environment.formal"));
        if(environment){
            logger.info("=====================当前项目启动正式环境=======================");
            System.out.println("=====================当前项目启动正式环境=======================");
        }else {
            logger.info("=====================当前项目启动测试环境=======================");
            System.out.println("=====================当前项目启动测试环境=======================");
        }
    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {

    }
}
